<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>SystemSharp: WaitRewriter.cs Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">SystemSharp
   &#160;<span id="projectnumber">0.3</span>
   </div>
   <div id="projectbrief">A system-level modeling framework for designing real-time embedded systems</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Packages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('_wait_rewriter_8cs_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Properties</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Events</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">WaitRewriter.cs</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_wait_rewriter_8cs.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="keyword">using</span> System;</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="keyword">using</span> System.Collections.Generic;</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">using</span> System.Linq;</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="keyword">using</span> System.Reflection;</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="keyword">using</span> System.Text;</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="keyword">using</span> System.Threading.Tasks;</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="keyword">using</span> SystemSharp.Analysis;</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="keyword">using</span> SystemSharp.Analysis.M2M;</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="keyword">using</span> SystemSharp.Common;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="keyword">using</span> SystemSharp.DataTypes;</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="keyword">using</span> SystemSharp.Meta;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="keyword">using</span> SystemSharp.SysDOM;</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="keyword">using</span> SystemSharp.SysDOM.Eval;</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="keyword">namespace </span>SystemSharp.Components</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;{</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    [AttributeUsage(AttributeTargets.Method)]</div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_await.html">   41</a></span>&#160;    <span class="keyword">class </span><a class="code" href="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_await.html">MapToWaitNTicksRewriteAwait</a> : <a class="code" href="class_system_sharp_1_1_components_1_1_rewrite_await.html">RewriteAwait</a>, <a class="code" href="interface_system_sharp_1_1_components_1_1_i_do_not_analyze.html">IDoNotAnalyze</a></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    {</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;        <span class="keyword">private</span> <span class="keyword">static</span> <span class="keywordtype">int</span> ictr = 0;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;</div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_await.html#aca3f5381f27cb19579f5a5011829099a">   45</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">override</span> <span class="keywordtype">bool</span> <a class="code" href="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_await.html#aca3f5381f27cb19579f5a5011829099a">Rewrite</a>(<a class="code" href="class_system_sharp_1_1_meta_1_1_code_descriptor.html">CodeDescriptor</a> decompilee, <a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_expression.html">Expression</a> waitObject, <a class="code" href="interface_system_sharp_1_1_analysis_1_1_i_decompiler.html">IDecompiler</a> stack, <a class="code" href="interface_system_sharp_1_1_sys_d_o_m_1_1_i_function_builder.html">IFunctionBuilder</a> builder)</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        {</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;            <span class="keywordflow">if</span> (stack.HasAttribute&lt;Analysis.M2M.HLS&gt;())</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;            {</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;            }</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;            var curps = DesignContext.Instance.CurrentProcess;</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;            <a class="code" href="class_system_sharp_1_1_components_1_1_s_l_signal.html">SLSignal</a> clk = (<a class="code" href="class_system_sharp_1_1_components_1_1_s_l_signal.html">SLSignal</a>)curps.Sensitivity[0].Owner;</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;            <a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_signal_ref.html">SignalRef</a> srEdge;</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;            if (curps.Predicate.Equals((Func&lt;bool&gt;)clk.RisingEdge))</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;                srEdge = <a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_signal_ref.html">SignalRef</a>.<a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_signal_ref.html#ae246b74ec4d21d47fb63f5a6a11d0e9c">Create</a>(clk.<a class="code" href="class_system_sharp_1_1_components_1_1_signal_base.html#a24e73fc31b4ccd743532d0534a6a2600">Descriptor</a>, <a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_signal_ref.html">SignalRef</a>.<a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_signal_ref.html#ac2602b9335fc17657b0147b8b917c727">EReferencedProperty</a>.RisingEdge);</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;            <span class="keywordflow">else</span></div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;                srEdge = SignalRef.Create(clk.Descriptor, SignalRef.EReferencedProperty.FallingEdge);</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;            var lrEdge = <span class="keyword">new</span> <a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_literal_reference.html">LiteralReference</a>(srEdge);</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;            <span class="keywordtype">int</span> nwait = 0;</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;            var nwaitEx = waitObject.Children[0];</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;            <span class="keywordtype">bool</span> nwaitConst = nwaitEx.IsConst();</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;            <span class="keywordflow">if</span> (nwaitConst)</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;            {</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;                nwait = (int)<a class="code" href="class_system_sharp_1_1_common_1_1_type_conversions.html">TypeConversions</a>.<a class="code" href="class_system_sharp_1_1_common_1_1_type_conversions.html#a73af19b1598538dd8f256f9fbff60929">ConvertValue</a>(</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;                        nwaitEx.Eval(<a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_eval_1_1_default_evaluator.html">DefaultEvaluator</a>.<a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_eval_1_1_default_evaluator.html#aca6cee743b165e194b637110e07bf6fe">DefaultConstEvaluator</a>),</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;                        typeof(<span class="keywordtype">int</span>));</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;            }</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;            var fspec = <span class="keyword">new</span> <a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_function_spec.html">FunctionSpec</a>(typeof(<span class="keywordtype">void</span>))</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;            {</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;                IntrinsicRep = IntrinsicFunctions.Wait(WaitParams.EWaitKind.WaitUntil)</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;            };</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;            <a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_variable.html">Variable</a> v = null;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;            <a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_literal_reference.html">LiteralReference</a> lrV = null;</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;            <span class="keywordflow">if</span> (!nwaitConst || nwait &gt; 3)</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;            {</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;                v = <span class="keyword">new</span> <a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_variable.html">Variable</a>(typeof(<span class="keywordtype">int</span>))</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;                {</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;                    Name = <span class="stringliteral">&quot;_wait_i&quot;</span> + (ictr++)</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;                };</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;                builder.DeclareLocal(v);</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;                lrV = <span class="keyword">new</span> <a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_literal_reference.html">LiteralReference</a>(v);</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;                builder.Store(v, LiteralReference.CreateConstant((int)0));</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;                var loop = builder.Loop();</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;                builder.If(Expression.Equal(lrV, nwaitEx));</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;                {</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;                    builder.Break(loop);</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;                }</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;                builder.EndIf();</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;            }</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;            <span class="keywordtype">int</span> ncalls = 1;</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;            <span class="keywordflow">if</span> (nwaitConst &amp;&amp; nwait &lt;= 3)</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;                ncalls = nwait;</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;            <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; ncalls; i++)</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;            {</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;                builder.Call(fspec, lrEdge);</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;            }</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;            <span class="keywordflow">if</span> (!nwaitConst || nwait &gt; 3)</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;            {</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;                builder.Store(v, lrV + LiteralReference.CreateConstant((int)1));</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;                builder.EndLoop();</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;            }</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;        }</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    }</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    [AttributeUsage(AttributeTargets.Method)]</div>
<div class="line"><a name="l00116"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_call.html">  116</a></span>&#160;    <span class="keyword">class </span><a class="code" href="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_call.html">MapToWaitNTicksRewriteCall</a> : <a class="code" href="class_system_sharp_1_1_components_1_1_rewrite_call.html">RewriteCall</a>, <a class="code" href="interface_system_sharp_1_1_components_1_1_i_do_not_analyze.html">IDoNotAnalyze</a></div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    {</div>
<div class="line"><a name="l00118"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_call.html#aed4a70b7ea00508ae17a5299e2db6cc2">  118</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">override</span> <span class="keywordtype">bool</span> <a class="code" href="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_call.html#aed4a70b7ea00508ae17a5299e2db6cc2">Rewrite</a>(<a class="code" href="class_system_sharp_1_1_meta_1_1_code_descriptor.html">CodeDescriptor</a> decompilee, MethodBase callee, <a class="code" href="struct_system_sharp_1_1_analysis_1_1_stack_element.html">StackElement</a>[] args, <a class="code" href="interface_system_sharp_1_1_analysis_1_1_i_decompiler.html">IDecompiler</a> stack, <a class="code" href="interface_system_sharp_1_1_sys_d_o_m_1_1_i_function_builder.html">IFunctionBuilder</a> builder)</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;        {</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;            var amd = stack.QueryAttribute&lt;<a class="code" href="class_system_sharp_1_1_analysis_1_1_async_method_decompiler.html">AsyncMethodDecompiler</a>&gt;();</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;            <span class="keywordflow">if</span> (amd != null &amp;&amp; amd.ImplStyle == <a class="code" href="namespace_system_sharp_1_1_analysis.html#aa6f8201151ffe82473815bec5267a43f">EAsyncImplStyle</a>.FSM)</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;            {</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;            }</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;            <span class="keywordtype">object</span>[] outArgs;</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;            <span class="keywordtype">object</span> result;</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;            stack.TryGetReturnValueSample((MethodInfo)callee, args, out outArgs, out result);</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;            var fspec = <span class="keyword">new</span> <a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_function_spec.html">FunctionSpec</a>(typeof(Task))</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;            {</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;                CILRep = callee</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;            };</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;            var fcall = <span class="keyword">new</span> <a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_function_call.html">FunctionCall</a>()</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;            {</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;                Callee = fspec,</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;                Arguments = args.Select(a =&gt; a.Expr).ToArray(),</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;                ResultType = TypeDescriptor.GetTypeOf(result)</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;            };</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;            stack.Push(fcall, result);</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;        }</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;    }</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;}</div>
<div class="ttc" id="class_system_sharp_1_1_sys_d_o_m_1_1_signal_ref_html_ae246b74ec4d21d47fb63f5a6a11d0e9c"><div class="ttname"><a href="class_system_sharp_1_1_sys_d_o_m_1_1_signal_ref.html#ae246b74ec4d21d47fb63f5a6a11d0e9c">SystemSharp.SysDOM.SignalRef.Create</a></div><div class="ttdeci">static SignalRef Create(ISignalOrPortDescriptor desc, EReferencedProperty prop)</div><div class="ttdoc">Creates a new signal reference literal. </div><div class="ttdef"><b>Definition:</b> <a href="_literals_8cs_source.html#l00882">Literals.cs:882</a></div></div>
<div class="ttc" id="interface_system_sharp_1_1_sys_d_o_m_1_1_i_function_builder_html"><div class="ttname"><a href="interface_system_sharp_1_1_sys_d_o_m_1_1_i_function_builder.html">SystemSharp.SysDOM.IFunctionBuilder</a></div><div class="ttdoc">Extends the algorithm builder interface by the capability of creating a SysDOM function. </div><div class="ttdef"><b>Definition:</b> <a href="_algorithms_8cs_source.html#l01810">Algorithms.cs:1810</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_type_conversions_html_a73af19b1598538dd8f256f9fbff60929"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_type_conversions.html#a73af19b1598538dd8f256f9fbff60929">SystemSharp.Common.TypeConversions.ConvertValue</a></div><div class="ttdeci">static object ConvertValue(object srcValue, Type dstType)</div><div class="ttdoc">Converts srcValue  to dstType  datatype, possibly with loss of precision or overflow. </div><div class="ttdef"><b>Definition:</b> <a href="_type_conversions_8cs_source.html#l00432">TypeConversions.cs:432</a></div></div>
<div class="ttc" id="namespace_system_sharp_1_1_analysis_html_aa6f8201151ffe82473815bec5267a43f"><div class="ttname"><a href="namespace_system_sharp_1_1_analysis.html#aa6f8201151ffe82473815bec5267a43f">SystemSharp.Analysis.EAsyncImplStyle</a></div><div class="ttdeci">EAsyncImplStyle</div><div class="ttdoc">The decompilation style of async methods </div><div class="ttdef"><b>Definition:</b> <a href="_async_state_machines_8cs_source.html#l00198">AsyncStateMachines.cs:198</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_components_1_1_signal_base_html_a24e73fc31b4ccd743532d0534a6a2600"><div class="ttname"><a href="class_system_sharp_1_1_components_1_1_signal_base.html#a24e73fc31b4ccd743532d0534a6a2600">SystemSharp.Components.SignalBase.Descriptor</a></div><div class="ttdeci">new SignalDescriptor Descriptor</div><div class="ttdef"><b>Definition:</b> <a href="_signals_core_8cs_source.html#l00420">SignalsCore.cs:420</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_sys_d_o_m_1_1_function_call_html"><div class="ttname"><a href="class_system_sharp_1_1_sys_d_o_m_1_1_function_call.html">SystemSharp.SysDOM.FunctionCall</a></div><div class="ttdoc">A function call expression. </div><div class="ttdef"><b>Definition:</b> <a href="_core_algebraic_8cs_source.html#l03496">CoreAlgebraic.cs:3496</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_await_html_aca3f5381f27cb19579f5a5011829099a"><div class="ttname"><a href="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_await.html#aca3f5381f27cb19579f5a5011829099a">SystemSharp.Components.MapToWaitNTicksRewriteAwait.Rewrite</a></div><div class="ttdeci">override bool Rewrite(CodeDescriptor decompilee, Expression waitObject, IDecompiler stack, IFunctionBuilder builder)</div><div class="ttdoc">Implements the await pattern for a given expression. </div><div class="ttdef"><b>Definition:</b> <a href="_wait_rewriter_8cs_source.html#l00045">WaitRewriter.cs:45</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_sys_d_o_m_1_1_signal_ref_html_ac2602b9335fc17657b0147b8b917c727"><div class="ttname"><a href="class_system_sharp_1_1_sys_d_o_m_1_1_signal_ref.html#ac2602b9335fc17657b0147b8b917c727">SystemSharp.SysDOM.SignalRef.EReferencedProperty</a></div><div class="ttdeci">EReferencedProperty</div><div class="ttdoc">Selects, which property of the signal is referenced </div><div class="ttdef"><b>Definition:</b> <a href="_literals_8cs_source.html#l00504">Literals.cs:504</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_sys_d_o_m_1_1_expression_html"><div class="ttname"><a href="class_system_sharp_1_1_sys_d_o_m_1_1_expression.html">SystemSharp.SysDOM.Expression</a></div><div class="ttdoc">An expression. </div><div class="ttdef"><b>Definition:</b> <a href="_core_algebraic_8cs_source.html#l01096">CoreAlgebraic.cs:1096</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_sys_d_o_m_1_1_variable_html"><div class="ttname"><a href="class_system_sharp_1_1_sys_d_o_m_1_1_variable.html">SystemSharp.SysDOM.Variable</a></div><div class="ttdoc">A local variable. </div><div class="ttdef"><b>Definition:</b> <a href="_literals_8cs_source.html#l00195">Literals.cs:195</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_type_conversions_html"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_type_conversions.html">SystemSharp.Common.TypeConversions</a></div><div class="ttdef"><b>Definition:</b> <a href="_type_conversions_8cs_source.html#l00033">TypeConversions.cs:33</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_sys_d_o_m_1_1_eval_1_1_default_evaluator_html_aca6cee743b165e194b637110e07bf6fe"><div class="ttname"><a href="class_system_sharp_1_1_sys_d_o_m_1_1_eval_1_1_default_evaluator.html#aca6cee743b165e194b637110e07bf6fe">SystemSharp.SysDOM.Eval.DefaultEvaluator.DefaultConstEvaluator</a></div><div class="ttdeci">static readonly DefaultEvaluator DefaultConstEvaluator</div><div class="ttdoc">An evaluator instance which is capable of evaluating everything except variables. ...</div><div class="ttdef"><b>Definition:</b> <a href="_default_evaluator_8cs_source.html#l00048">DefaultEvaluator.cs:48</a></div></div>
<div class="ttc" id="interface_system_sharp_1_1_components_1_1_i_do_not_analyze_html"><div class="ttname"><a href="interface_system_sharp_1_1_components_1_1_i_do_not_analyze.html">SystemSharp.Components.IDoNotAnalyze</a></div><div class="ttdoc">Marker interface for methods which must not be included into system analysis. </div><div class="ttdef"><b>Definition:</b> <a href="_components_attributes_8cs_source.html#l01234">ComponentsAttributes.cs:1234</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_sys_d_o_m_1_1_function_spec_html"><div class="ttname"><a href="class_system_sharp_1_1_sys_d_o_m_1_1_function_spec.html">SystemSharp.SysDOM.FunctionSpec</a></div><div class="ttdoc">A function specifier with possibly multiple representations in different domains. ...</div><div class="ttdef"><b>Definition:</b> <a href="_core_algebraic_8cs_source.html#l03377">CoreAlgebraic.cs:3377</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_meta_1_1_code_descriptor_html"><div class="ttname"><a href="class_system_sharp_1_1_meta_1_1_code_descriptor.html">SystemSharp.Meta.CodeDescriptor</a></div><div class="ttdoc">This abstract class describes code in the CLI and SysDOM domain. </div><div class="ttdef"><b>Definition:</b> <a href="_components_reflection_8cs_source.html#l01472">ComponentsReflection.cs:1472</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_await_html"><div class="ttname"><a href="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_await.html">SystemSharp.Components.MapToWaitNTicksRewriteAwait</a></div><div class="ttdoc">Transforms expressions like await n.Ticks() to a SysDOM-compliant representation using &quot;WaitUntil&quot; in...</div><div class="ttdef"><b>Definition:</b> <a href="_wait_rewriter_8cs_source.html#l00041">WaitRewriter.cs:41</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_components_1_1_rewrite_await_html"><div class="ttname"><a href="class_system_sharp_1_1_components_1_1_rewrite_await.html">SystemSharp.Components.RewriteAwait</a></div><div class="ttdoc">This attribute is attached to classes and structs. It indicates that the await pattern for await oper...</div><div class="ttdef"><b>Definition:</b> <a href="_components_attributes_8cs_source.html#l01300">ComponentsAttributes.cs:1300</a></div></div>
<div class="ttc" id="interface_system_sharp_1_1_analysis_1_1_i_decompiler_html"><div class="ttname"><a href="interface_system_sharp_1_1_analysis_1_1_i_decompiler.html">SystemSharp.Analysis.IDecompiler</a></div><div class="ttdoc">This interface models the decompiler functionality. It is intended to be used inside method rewriters...</div><div class="ttdef"><b>Definition:</b> <a href="_m_s_i_l_decompiler_8cs_source.html#l00666">MSILDecompiler.cs:666</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_sys_d_o_m_1_1_eval_1_1_default_evaluator_html"><div class="ttname"><a href="class_system_sharp_1_1_sys_d_o_m_1_1_eval_1_1_default_evaluator.html">SystemSharp.SysDOM.Eval.DefaultEvaluator</a></div><div class="ttdoc">A default implementation of a SysDOM expression evaluator. </div><div class="ttdef"><b>Definition:</b> <a href="_default_evaluator_8cs_source.html#l00043">DefaultEvaluator.cs:43</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_components_1_1_s_l_signal_html"><div class="ttname"><a href="class_system_sharp_1_1_components_1_1_s_l_signal.html">SystemSharp.Components.SLSignal</a></div><div class="ttdoc">A signal which carries logic values </div><div class="ttdef"><b>Definition:</b> <a href="_std_logic_lib_8cs_source.html#l02308">StdLogicLib.cs:2308</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_analysis_1_1_stack_element_html"><div class="ttname"><a href="struct_system_sharp_1_1_analysis_1_1_stack_element.html">SystemSharp.Analysis.StackElement</a></div><div class="ttdoc">This structure represents a stack element, which is identified by a symbolic expression and a value s...</div><div class="ttdef"><b>Definition:</b> <a href="_m_s_i_l_decompiler_8cs_source.html#l00597">MSILDecompiler.cs:597</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_components_1_1_rewrite_call_html"><div class="ttname"><a href="class_system_sharp_1_1_components_1_1_rewrite_call.html">SystemSharp.Components.RewriteCall</a></div><div class="ttdoc">If this attribute is attached to any method or constructor, it instructs the decompiler to treat any ...</div><div class="ttdef"><b>Definition:</b> <a href="_components_attributes_8cs_source.html#l00181">ComponentsAttributes.cs:181</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_analysis_1_1_async_method_decompiler_html"><div class="ttname"><a href="class_system_sharp_1_1_analysis_1_1_async_method_decompiler.html">SystemSharp.Analysis.AsyncMethodDecompiler</a></div><div class="ttdoc">This class provides functionality to decompile async methods. </div><div class="ttdef"><b>Definition:</b> <a href="_async_state_machines_8cs_source.html#l00214">AsyncStateMachines.cs:214</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_call_html"><div class="ttname"><a href="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_call.html">SystemSharp.Components.MapToWaitNTicksRewriteCall</a></div><div class="ttdoc">Transforms expressions like await n.Ticks() to a SysDOM-compliant representation using &quot;WaitUntil&quot; in...</div><div class="ttdef"><b>Definition:</b> <a href="_wait_rewriter_8cs_source.html#l00116">WaitRewriter.cs:116</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_sys_d_o_m_1_1_literal_reference_html"><div class="ttname"><a href="class_system_sharp_1_1_sys_d_o_m_1_1_literal_reference.html">SystemSharp.SysDOM.LiteralReference</a></div><div class="ttdoc">A reference expression to a literal. </div><div class="ttdef"><b>Definition:</b> <a href="_core_algebraic_8cs_source.html#l02101">CoreAlgebraic.cs:2101</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_call_html_aed4a70b7ea00508ae17a5299e2db6cc2"><div class="ttname"><a href="class_system_sharp_1_1_components_1_1_map_to_wait_n_ticks_rewrite_call.html#aed4a70b7ea00508ae17a5299e2db6cc2">SystemSharp.Components.MapToWaitNTicksRewriteCall.Rewrite</a></div><div class="ttdeci">override bool Rewrite(CodeDescriptor decompilee, MethodBase callee, StackElement[] args, IDecompiler stack, IFunctionBuilder builder)</div><div class="ttdoc">Implements the special treatment of a method call. </div><div class="ttdef"><b>Definition:</b> <a href="_wait_rewriter_8cs_source.html#l00118">WaitRewriter.cs:118</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_sys_d_o_m_1_1_signal_ref_html"><div class="ttname"><a href="class_system_sharp_1_1_sys_d_o_m_1_1_signal_ref.html">SystemSharp.SysDOM.SignalRef</a></div><div class="ttdoc">Signal reference literal </div><div class="ttdef"><b>Definition:</b> <a href="_literals_8cs_source.html#l00498">Literals.cs:498</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_bb5e995590685548b7e11478911ee7c3.html">SystemSharp-Google-SVN</a></li><li class="navelem"><a class="el" href="dir_8deefa4467a62b572b52d238d562b104.html">SystemSharp</a></li><li class="navelem"><a class="el" href="dir_0e5a72156f8560bbc472a395da2569d6.html">SystemSharp</a></li><li class="navelem"><a class="el" href="dir_9d3c30b4336bd92c64ccf0aeee487ace.html">SystemSharp</a></li><li class="navelem"><a class="el" href="dir_2796d14d34df7db36a6563efa1efe523.html">Components</a></li><li class="navelem"><a class="el" href="dir_0641d69b8d33fd6940e80d7bf6cf0909.html">Rewriters</a></li><li class="navelem"><a class="el" href="_wait_rewriter_8cs.html">WaitRewriter.cs</a></li>
    <li class="footer">Generated on Thu Dec 26 2013 14:21:44 for SystemSharp by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
